package com.excellent.service;

import com.excellent.cloudApi.Chat;
import com.excellent.cloudApi.ChatInit;
import com.excellent.entity.ChatResponse;
import org.springframework.stereotype.Service;

@Service
public class ChatService {
    public ChatResponse getChat(String appId, String question) {
        ChatResponse answer;
        try {
            String consersationId = ChatInit.getConsersationId(appId);
            answer = Chat.getAnswer(appId, consersationId, question);
        } catch (Exception e) {
            System.out.println(e.getMessage());
            throw new RuntimeException(e);
        }
        return answer;
    }
}